<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="../common.jsp"%>
<%@ page import="cn.firstsoft.firstframe.admin.PropertyFile"%>
<%@ page import="org.springside.core.Constants" %>
<%@ page import="java.io.*,java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>管理控制台 - 环境设置 - 数据同步设置</title>
<%@ include file="/common/meta2.jsp"%>
<link href="../style.css" type="text/css" rel=stylesheet>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
	<table width="100%" align="center" >
		<TR>
			<TH class=listViewPaginationTdS1  align=left colSpan=4>
			设置数据同步设置结果
			</TH>
		</TR>
		<tr>
			<td widht="100%">
<%

  try{
    String dataSync = request.getParameter("dataSync");
	String initPersonAllSql = request.getParameter("initPersonAllSql");
	String detailInfo = request.getParameter("detailInfo");
	String positionPOS = request.getParameter("positionPOS");
	
    if("no".equals(dataSync)){
    	PropertyFile.writeProperties("firstframe.properties", "plugins.eas", "false");
    	PropertyFile.writeProperties("firstframe.properties", "plugins.k3", "false");
    }else if("k3".equals(dataSync)){
    	PropertyFile.writeProperties("firstframe.properties", "plugins.k3", "true");
    	PropertyFile.writeProperties("firstframe.properties", "plugins.eas", "false");
    }else if("eas".equals(dataSync)){
    	PropertyFile.writeProperties("firstframe.properties", "plugins.eas", "true");
    	PropertyFile.writeProperties("firstframe.properties", "plugins.k3", "false");
	    
		if (initPersonAllSql == null) initPersonAllSql = "false";
		if ("true".equals(initPersonAllSql)) {
			//initPersonAllSql = "select person.Fid, person.FName_L2 as name,person.FGender,person.FEmail,person.FAddress_L2, person.FHomePhone, person.FOfficePhone,person.FCell, e.fid as orgunitid, e.fname_l2 as orgname, person.FDeletedStatus as FDeletedStatus, person.FNumber as FNumber, person.FEmployeeTypeID as FEmployeeTypeID from t_bd_person person left outer join t_org_positionmember c on person.fid = c.fpersonid left outer join t_org_position d on d.fid = c.fpositionid left outer join T_ORG_ADMIN e on e.fid = d.fadminorgunitid where  c.fisPrimary = 1";
		    initPersonAllSql = "select person.Fid, person.FName_L2 as name,person.FGender,person.FEmail,person.FAddress_L2, person.FHomePhone, person.FOfficePhone,person.FCell, e.fid as orgunitid, e.fname_l2 as orgname, person.FDeletedStatus as FDeletedStatus, person.FNumber as FNumber, person.FEmployeeTypeID as FEmployeeTypeID, person.FBirthday as FBirthday, person.FBackupEMail as FBackupEMail, person.FDescription_L2 as FDescription, person.FRTX as FRTX from t_bd_person person left outer join t_org_positionmember c on person.fid = c.fpersonid left outer join t_org_position d on d.fid = c.fpositionid left outer join T_ORG_ADMIN e on e.fid = d.fadminorgunitid where  c.fisPrimary = 1";
		} else {
			initPersonAllSql = "";
		}
		PropertyFile.writeProperties("easconfig.properties", "eas.initPersonAllSql", initPersonAllSql);
		PropertyFile.writeProperties("easconfig.properties", "eas.detailInfo", detailInfo);
		PropertyFile.writeProperties("easconfig.properties", "eas.positionPOS", positionPOS);
	}
    
     response.sendRedirect("data_sync_setting.jsp?flag=suc");
    }catch(Exception e){
	 response.sendRedirect("data_sync_setting.jsp?flag=err");
  }
    
%>


			</td>
		</tr>
	</table>
</body>
</html>
